home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 12 / 012.d81 / three deep (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  1KB  |  43 lines

  1. 7000 rem alpha order by distr counting-3 deep*by tom foster*
  2. 7001 print:print:print:print"please wait about 1 minute while";
  3. 7003 print" the  file is alphabetized.   *thank you*   "
  4. 7010 dimr(26),aa$(300),bb$(300),cc(300)
  5. 7020 fori=1tot:l=asc(mid$(a$(i),3,1))-64
  6. 7025 ifl=-32thenl=0
  7. 7030 r(l)=r(l)+1
  8. 7035 next
  9. 7040 fork=1to26:r(k)=r(k)+r(k-1):next
  10. 7045 forj=tto1step-1:l=asc(mid$(a$(j),3,1))-64
  11. 7050 ifl=-32thenl=0
  12. 7055 i=r(l):aa$(i)=a$(j):bb$(i)=b$(j):cc(i)=c(j)
  13. 7057 r(l)=i-1
  14. 7058 next
  15. 7060 fori=1tot:printaa$(i):next:rem * if you want to see first cycle *
  16. 7101 print:print:print"it won't be long now"
  17. 7110 dimrb(26),ab$(300),bc$(300),cd(300)
  18. 7120 fori=1tot:lb=asc(mid$(aa$(i),2,1))-64
  19. 7125 iflb=-32thenlb=0
  20. 7130 rb(lb)=rb(lb)+1
  21. 7135 next
  22. 7140 forkb=1to26:rb(kb)=rb(kb)+rb(kb-1):next
  23. 7145 forjb=tto1step-1:lb=asc(mid$(aa$(jb),2,1))-64
  24. 7150 iflb=-32thenlb=0
  25. 7155 i=rb(lb):ab$(i)=aa$(jb):bc$(i)=bb$(jb):cd(i)=cc(jb)
  26. 7157 rb(lb)=i-1
  27. 7158 next
  28. 7160 fori=1tot:printaa$(i):next:rem * if you want to see second cycle *
  29. 8001 print:print:print"i'm almost finished."
  30. 8010 dims(26),ac$(300),bd$(300),ce(300)
  31. 8020 fori=1tot:m=asc(ab$(i))-64
  32. 8025 ifm=-32thenm=0
  33. 8030 s(m)=s(m)+1
  34. 8035 next
  35. 8040 forkk=1to26:s(kk)=s(kk)+s(kk-1):next
  36. 8045 forjj=tto1step-1:m=asc(ab$(jj))-64
  37. 8050 ifm=-32thenm=0
  38. 8055 i=s(m):ac$(i)=ab$(jj):bd$(i)=bc$(jj):ce(i)=cd(jj)
  39. 8057 s(m)=i-1
  40. 8058 next
  41. 8060 fori=1tot:printac$(i):next:rem * if you want to see final cycle *
  42. 8070 return
  43.